<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite) ? (include $this->template('pc_header', TEMPLATE_INCLUDEPATH)) : (include template('pc_header', TEMPLATE_INCLUDEPATH));?>
<link rel="stylesheet" type="text/css" href="<?php echo MODULE_URL;?>template/mobile/app/css/screen_lottory_free.css">
<link rel="stylesheet" type="text/css" href="<?php echo MODULE_URL;?>template/mobile/app/css/linewell_qd.css">  
<script src="<?php echo MODULE_URL;?>template/mobile/app/js/qdbase.js?20154223" type="text/javascript" charset="utf-8"></script>
<script src="<?php echo MODULE_URL;?>template/mobile/app/js/screen_qd.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class="FUN WALL" <?php  if(!empty($basic_config['bg_vedio'])) { ?>data-vide-bg="<?php  echo tomedia($basic_config['bg_vedio'])?>"<?php  } ?>>
    <?php (!empty($this) && $this instanceof WeModuleSite) ? (include $this->template('top_panel', TEMPLATE_INCLUDEPATH)) : (include template('top_panel', TEMPLATE_INCLUDEPATH));?>
    <div class="Panel Lottery" style="display: block; opacity: 1;">
      <div class="tuchu ">
        <div class="tuchug">
          <img src="<?php echo MODULE_URL;?>template/mobile/app/images/icon/bbb.png"></div>
        <div class="tuchuk">
          <img class="tx" id="qdtx" src="http://wx.qlogo.cn/mmopen/ctSue0WnfibLR4ponCgXLv4G9Y43YFEXv5UboZuvHbvwkz6QXEYvw4RyuktMxhicq22efPTnwhPRhT67FIia2dmKDlIb4falNbN/132">
          <p class="pm">第
            <span class="red" id="qdnums">0</span>位签到</p>
          <p class="xm" id="qdname">官方签到女神</p></div>
      </div>
      <div class="qiandao" id="ddd" style="display: none;">
        <ul id="divDetail">
		<?php  if(is_array($qds)) { foreach($qds as $key => $row) { ?>
          <li id="dh<?php  echo $key+1?>">
            <img class="qiaodaotx" id="hd<?php  echo $key+1?>" src="<?php  echo $row['avatar'];?>">
            <p class="qiaodaoxm" id="nc<?php  echo $key+1?>"><?php  echo $row['nick_name'];?></p>
            <p id="qd<?php  echo $key+1?>" class="qiaodaopm"><?php  echo $key+1?></p>
		  </li>
		<?php  } } ?>
        </ul>
      </div>
      <script>
	  function senddh(n) {
          var count2 = $('#divDetail li').size();//0
          if (n <= count2) {//无人签到
            $("#dh" + n).addClass('qiaodaosf');
            var div = document.getElementById('divDetail');
            document.getElementById('ddd').scrollTop = div.scrollHeight;
            n = n + 1;
            setTimeout("senddh(" + n + ")", 500);
          } else {
            setTimeout("getjson(" + <?php  echo $qd_maxid;?> + ")", 1000);
          }
        }

        function senddh2(n) {
          if (n > 0 && window.ssss != 0) {
            $("#dh" + n).removeClass('qiaodaosf');
            var div = document.getElementById('divDetail');
            document.getElementById('ddd').scrollTop = div.scrollHeight;
            n = n - 1;
            setTimeout("senddh2(" + n + ")", 500);
          } else {
            setTimeout("senddh(" + n + ")", 1000);
          }
        }

        var mid;
        var b;
        var ssss = 0;
        var ii = <?php  echo $qd_nums;?>;
        function getjson(v) {
          $(".tuchu").removeClass('view');
          $.getJSON(
       		  Path_url('new_qd'), 
       		  {
       			  rid: scene_id,
       			  mid: v
			  },
	          function(result) {
	            var b = result.mid;//最大的id
	            var omid = result.omid;//老的最大的
	            window.mid = b;
	            if (omid < b) {
	              window.ii = window.ii + 1;
	              window.ssss = 0;
	              var i = $('#divDetail li').size() + 1;
	
	              $("#qdtx").attr("src", result.avatar);
	              $("#qdnums").html(result.qdnums);
	              $("#qdname").html(result.nick_name);
	              $(".tuchu").addClass('view');
	
	              setTimeout(function() {
	                var item = '<li id="dh' + i + '" class="qiaodaosf" ><img class="qiaodaotx"  id="hd' + i + '" src="' + result.avatar + '"><p id="nc' + i + '" class="qiaodaoxm">' + result.nick_name + '</p><p id="qd' + i + '" class="qiaodaopm">' + result.qdnums + '</p></li>';
	                $('#divDetail').append(item);
	                var div = document.getElementById('divDetail');
	                document.getElementById('ddd').scrollTop = div.scrollHeight;
	              },7000);
	            } else {
	              window.ssss = window.ssss + 1;//1
	              if (window.ssss > 1) {
	                var s = $('#divDetail li').size() + 1;//2
	                var sjs = Math.floor(Math.random() * s);
					if(sjs!=0){
		                $("#qdtx").attr("src", $("#hd" + sjs).attr("src"));
		                $("#qdnums").html($("#qd" + sjs).html());
		                $("#qdname").html($("#nc" + sjs).html());
		                $(".tuchu").addClass('view');
					}
	              }
	            }
	            setTimeout("getjson(" + b + ")", 10000);
	          }
			);
        }
        </script>
</div>
<?php (!empty($this) && $this instanceof WeModuleSite) ? (include $this->template('pc_footer', TEMPLATE_INCLUDEPATH)) : (include template('pc_footer', TEMPLATE_INCLUDEPATH));?>